<template>
  <div class='bookInfo'>
    <div class='thumb'>
      <img class='back'
           :src="info.image"
           mode='aspectFill'>
      <img class='center'
           :src="info.image"
           mode='aspectFit'>
      <div class="info">
        <div class="title">
          {{info.title}}
        </div>
        <div class="author">
          {{info.author}}
        </div>
      </div>
    </div>
    <div class='detail'>
      <img :src="userinfo.image"
           class='avatar'
           mode='aspectFit'>
      {{userinfo.name}}
      <div class="right">
        {{info.rate}}分
        <div class='rate'>
          <Rate :value='info.rate'></Rate>
        </div>
      </div>
    </div>
    <div class="detail">
      {{info.publisher}}
      <div class='right'>
        {{info.price}}
      </div>
    </div>
    <div class='tags'
         v-for='tag in info.tags'
         :key='tag'>{{tag}}
    </div>
    <div class='summary'>
      <p v-for='(sum,index) in info.summary'
         :key='index'>{{sum}}
      </p>
    </div>

  </div>
</template>

<script>
import Rate from '@/components/Rate'
export default {
  props: ['info'],
  computed: {
    userinfo () {
      return this.info.user_info || {}
    }
  },
  components: {
    Rate
  }
}
</script>

<style scoped lang='scss'>
.bookInfo {
  font-size: 14px;
  .tags {
    display: inline-block;
    margin: 4px;
    padding: 3px 3px;
    color: #ea5149;
    border: 1px solid #ea5149;
    border-radius: 5px;
  }
  .summary {
    margin-top: 10px;
    padding: 0 10px;
    p {
      text-indent: 2em;
      font-size: 14px;
    }
  }
  .detail {
    padding: 5px 10px;

    .avatar {
      height: 20px;
      width: 20px;
      border-radius: 50%;
      vertical-align: middle;
    }
    .right {
      float: right;
      .rate {
        vertical-align: top;
      }
    }
  }
  .thumb {
    width: 750rpx;
    height: 500rpx;
    overflow: hidden;
    position: relative;
    .back {
      filter: blur(15px);
      width: 100%;
    }
    .center {
      position: absolute;
      height: 300rpx;
      width: 100%;
      top: 30rpx;
      left: 0;
    }
    .info {
      color: white;
      position: absolute;
      width: 100%;
      left: 0;
      top: 330rpx;
      text-align: center;
      .title {
        font-size: 20px;
      }
      .author {
        font-size: 12px;
      }
    }
  }
}
</style>